home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 316 / libsrc / strncmp.c < prev    next >
Encoding:
Text File  |  1988-10-20  |  440 b   |  23 lines

  1. /*
  2.  *        Cross Development System for Atari ST 
  3.  *     Copyright (c) 1988, Memorial University of Newfoundland
  4.  *
  5.  * $Header: strncmp.c,v 1.1 88/01/29 17:34:12 m68k Exp $
  6.  *
  7.  * $Log:    strncmp.c,v $
  8.  * Revision 1.1  88/01/29  17:34:12  m68k
  9.  * Initial revision
  10.  * 
  11.  */
  12. int
  13. strncmp(s1, s2, n)
  14.     char    *s1;
  15.     char    *s2;
  16.     int    n;
  17. {
  18.     while (--n >= 0 && (*s1 == *s2++))
  19.         if (!*s1++)
  20.             return 0;
  21.     return n < 0 ? 0 : *s1 - *--s2;
  22. }
  23.